<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:a4j="http://richfaces.org/a4j"
                 xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <title>资产管理</title>
        <style type="text/css">
            input[type='submit']{
                margin: 3px 5px 3px 5px;
                padding:3px 5px 3px 5px;
            }
        </style>
    </h:head>
    <h:form id="audit">
        <rich:tabPanel switchType="ajax" styleClass="content-hight">
            <rich:tab header="审核资产" contentClass="tab-content-hight">
                <h:panelGrid columns="2">
                    <h:outputLabel value="部 门: " />
                    <h:selectOneMenu  value="#{deptAndEmp.deptCode}">
                        <f:selectItem itemValue="" itemLabel="-请选择-"/>
                        <f:selectItems value="#{deptAndEmp.selectItemList}"/>
                        <a4j:ajax event="change" listener="#{deptAndEmp.deptChange}" render="button,usern"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="操作员: " />
                    <h:panelGroup id="usern">
                        <h:selectOneMenu  id="ausername" value="#{assetAudit.noAuditedPsn.cpsn_number}">
                            <f:selectItem itemValue=" " itemLabel="-请选择-"/>
                            <f:selectItems value="#{deptAndEmp.person}" />
                            <a4j:ajax event="change" render="button"/>
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <h:outputLabel value="是否来自政采：" />
                    <h:panelGroup>
                        <h:selectOneMenu value="#{assetAudit.fromProcure}">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItem itemValue="1" itemLabel="是"/>
                            <f:selectItem itemValue="0" itemLabel="否"/>
                            <a4j:ajax event="change" render="button"/>
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <a4j:commandButton id="button" value="资产查询"
                                       action="#{assetAudit.queryPsnAssetData_scrap}"
                                       disabled="#{empty deptAndEmp.deptCode}"
                                       render="assetList"
                                       onclick="this.disabled = 'true';"/>
                    <a4j:commandButton value="审核通过"
                                       action="#{assetAudit.passed_scrap}"
                                       onclick="this.disabled = 'true';"
                                       render="@this,assetList"/>
                </h:panelGrid>
                <h:panelGroup id="assetList">
                    <rich:dataScroller execute="@this" render="assetList" for="assetTalbe"/>
                    <rich:extendedDataTable id="assetTalbe" value="#{assetAudit.psnAssets_scrap}" var="asset"
                                            rows="15"
                                            style="width:740px">
                        <rich:column width="35px">
                            <f:facet name="header">
                                <h:selectBooleanCheckbox  value="#{assetAudit.all}">
                                    <a4j:ajax event="click" render="assetList" listener="#{assetAudit.psnCardsSelected_scrap}"/>
                                </h:selectBooleanCheckbox>
                            </f:facet>
                            <h:selectBooleanCheckbox  value="#{asset.checkFlag}" >
                                <a4j:ajax event="click" render="assetList"/>
                            </h:selectBooleanCheckbox>
                        </rich:column>
                        <rich:column width="60px" style="text-align: center;">
                            <f:facet name="header">
                                <h:panelGroup style="white-space: nowrap;">
                                <h:outputText  value="使用状况"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="在用"  rendered="#{asset.useStatus == '0'}"/>
                            <h:outputText value="报废"  rendered="#{asset.useStatus == '1'}" style="color:blue;"/>
                            <h:outputText value="报损"  rendered="#{asset.useStatus == '2'}" style="color:red;"/>
                            <h:outputText value="其他"  rendered="#{asset.useStatus == '3'}" style="color:ccddff;"/>
                        </rich:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="资产编号"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetCode}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="资产名称"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="规格型号"/>
                            </f:facet>
                            <h:outputText value="#{asset.model}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="单价"/>
                            </f:facet>
                            <h:outputText value="#{asset.price}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="品牌"/>
                            </f:facet>
                            <h:outputText value="#{asset.brand}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="厂商"/>
                            </f:facet>
                            <h:outputText value="#{asset.manufacture}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="购置日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.purchDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="质保日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.shelfLife}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="备注"/>
                            </f:facet>
                            <h:outputText value="#{asset.memo}"/>
                        </h:column>
                    </rich:extendedDataTable>
                </h:panelGroup>
            </rich:tab>
            <rich:tab header="取消审核" contentClass="tab-content-hight">
                <h:panelGrid columns="2">
                    <h:outputLabel value="部 门: " />
                    <h:selectOneMenu  value="#{deptAndEmp.deptCode1}">
                        <f:selectItem itemValue="" itemLabel="-请选择-"/>
                        <f:selectItems value="#{deptAndEmp.selectItemList}"/>
                        <a4j:ajax event="change" listener="#{deptAndEmp.deptForCancelChange}" render="button1,cusern"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="操作员: " />
                    <h:panelGroup id="cusern">
                        <h:selectOneMenu  id="username" value="#{assetAudit.auditedPsn.cpsn_number}">
                            <f:selectItem itemValue=" " itemLabel="-请选择-"/>
                            <f:selectItems value="#{deptAndEmp.psnForCancel}" />
                            <a4j:ajax event="change" render="button1"/>
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <h:outputLabel value="是否来自政采：" />
                    <h:panelGroup>
                        <h:selectOneMenu value="#{assetAudit.fromProcure_cancel}">
                            <f:selectItem itemValue="" itemLabel="-请选择-"/>
                            <f:selectItem itemValue="1" itemLabel="是"/>
                            <f:selectItem itemValue="0" itemLabel="否"/>
                            <a4j:ajax event="change" render="button1"/>
                        </h:selectOneMenu>
                    </h:panelGroup>
                    <a4j:commandButton id="button1" value="资产查询"
                                       action="#{assetAudit.queryAuditedPsnAssetData_scrap}"
                                       disabled="#{empty deptAndEmp.deptCode1}"
                                       render="auditedAssets"
                                       onclick="this.disabled = 'true';"/>
                    <a4j:commandButton value="取消审核"
                                       action="#{assetAudit.cancelAudited_scrap}"
                                       onclick="this.disabled = 'true';"
                                       render="@this,auditedAssets"/>
                </h:panelGrid>
                <h:panelGroup id="auditedAssets">
                    <rich:dataScroller for="auditedTable"/>
                    <rich:extendedDataTable id="auditedTable"
                                            style="width:740px;" rows="15"
                                            value="#{assetAudit.auditedAssets_scrap}" var="asset">
                        <rich:column width="30px">
                            <f:facet name="header">
                                <h:selectBooleanCheckbox  value="#{assetAudit.auditedAll}">
                                    <a4j:ajax event="click" render="auditedAssets" listener="#{assetAudit.selectAudited_scrap}"/>
                                </h:selectBooleanCheckbox>
                            </f:facet>
                            <h:selectBooleanCheckbox  value="#{asset.selected}" >
                                <a4j:ajax event="click" render="auditedAssets"/>
                            </h:selectBooleanCheckbox>
                        </rich:column>
                        <rich:column width="80px" style="text-align:center;">
                            <f:facet name="header">
                                <h:outputText  value="使用状况"/>
                            </f:facet>
                            <h:outputText value="在用"  rendered="#{asset.useStatus == '0'}"/>
                            <h:outputText value="报废"  rendered="#{asset.useStatus == '1'}" style="color:blue;"/>
                            <h:outputText value="报损"  rendered="#{asset.useStatus == '2'}" style="color:red;"/>
                            <h:outputText value="其他"  rendered="#{asset.useStatus == '3'}" style="color:ccddff;"/>
                        </rich:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="资产编号"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetCode}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="资产名称"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="规格型号"/>
                            </f:facet>
                            <h:outputText value="#{asset.model}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="单价"/>
                            </f:facet>
                            <h:outputText value="#{asset.price}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="品牌"/>
                            </f:facet>
                            <h:outputText value="#{asset.brand}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="厂商"/>
                            </f:facet>
                            <h:outputText value="#{asset.manufacture}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="购置日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.purchDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="质保日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.shelfLife}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText  value="备注"/>
                            </f:facet>
                            <h:outputText value="#{asset.memo}"/>
                        </h:column>
                    </rich:extendedDataTable>
                </h:panelGroup>
            </rich:tab>
        </rich:tabPanel>
    </h:form>
</ui:composition>